
package xijia.plus.docs.manage.all.controller;

import io.github.wslxm.springbootplus2.core.base.controller.BaseController;
import io.github.wslxm.springbootplus2.core.constant.BaseConstant;
import io.github.wslxm.springbootplus2.core.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import xijia.plus.docs.constant.RequestConst;
import xijia.plus.docs.manage.all.service.ExportService;

/**
 * 文档表 前端控制器
 *
 * <p>
 * ::本代码由[兮家小二]提供的代码生成器生成,如有问题,请手动修改 ::作者CSDN:https://blog.csdn.net/qq_41463655
 * </p>
 *
 * @author ws
 * @email 1720696548@qq.com 解析
 * @date 2022-10-18 15:11:33
 */
@RestController
@RequestMapping(BaseConstant.Uri.API_ADMIN + "/all/export")
@Api(value = "ExportController", tags = "导入/导出")
public class ExportController extends BaseController {

    @Autowired
    private ExportService exportService;


    @PostMapping(value = "/import")
    @ApiOperation(value = "导入, 直接上传MD文件压缩包 (包含文件和目录)")
    public Result<Boolean> importMd(@RequestParam(required = true) MultipartFile file, Integer type) {
        return Result.success(exportService.importMd(request.getHeader(RequestConst.DB),file, type));
    }


    @PostMapping(value = "/export")
    @ApiOperation(value = "导出")
    public Result<Boolean> exportMd(Integer type) {
        return Result.success(exportService.exportMd(request.getHeader(RequestConst.DB),type));
    }

    @GetMapping(value = "/getExportMdDownloadPath")
    @ApiOperation(value = "导出下载")
    public Result<String> getExportMdDownloadPath(Integer type) {
       return Result.success(exportService.getExportMdDownloadPath(request.getHeader(RequestConst.DB),type)) ;
    }
}
